package com.egao.orderB.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
//import com.egao.orderB.mapper.PutInfoMapper;
import com.egao.orderB.entity.PutInfo;
import com.egao.orderB.service.PutInfoService;
import org.springframework.stereotype.Service;
import com.egao.orderB.biz.PutInfoBiz;
import net.sf.json.JSONObject;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
//import javax.transaction.Transactional;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 入库单基本信息服务实现类
 * @author : Doman
 * @date : 2021-12-23 16:56:05
 * @version ：1.0
 */
@Service
public class PutInfoServiceImpl /*extends ServiceImpl<PutInfoMapper, PutInfo> */implements PutInfoService {

	@Autowired
	private PutInfoBiz putInfoBiz;

  @Override
  public JsonResult list(PageResult2<T> page, PutInfo putInfo, User loginUser)  throws Exception{
    return putInfoBiz.list(page,putInfo,loginUser);
  }

  @Override
  public JsonResult list(PutInfo putInfo, User loginUser) {
    return JsonResult.ok().setData(putInfoBiz.list(putInfo,loginUser));
  }

  @Override
  public JsonResult getById(PutInfo putInfo) {
    return JsonResult.ok().setData(putInfoBiz.getById(putInfo));
  }

  @Transactional
  @Override
  public JsonResult save(PutInfo putInfo, User loginUser) {
    if (putInfoBiz.save(putInfo, loginUser)) {
      return JsonResult.ok("添加成功");
    }
    return JsonResult.error("添加失败");
  }

  @Transactional
  @Override
  public JsonResult update(PutInfo putInfo, User loginUser) {
    if (putInfoBiz.update(putInfo, loginUser)) {
      return JsonResult.ok("修改成功");
    }
    return JsonResult.error("修改失败");
  }

  @Transactional
  @Override
  public JsonResult remove(PutInfo putInfo, User loginUser) {
    if (putInfoBiz.remove(putInfo, loginUser)) {
      return JsonResult.ok("删除成功");
    }
    return JsonResult.error("删除失败");
  }

}
